package com.hao1st.service2.biz.distributedtx.controller;

import com.hao1st.service2.biz.distributedtx.service.DTXService;
import jakarta.annotation.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 分布式事务的demo Controller
 */
@RestController
@RequestMapping("/dtx")
public class DTXController {

    @Resource
    private DTXService dtxService;

    @GetMapping("/index")
    public String index(@RequestHeader HttpHeaders httpHeaders) throws Exception {
        return dtxService.insNewUser(httpHeaders);
    }
}
